package com.auxgroup.smarthome.events;

import com.auxgroup.smarthome.service.HomeDistanceMqttService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.context.event.ApplicationReadyEvent;
import org.springframework.context.ApplicationListener;
import org.springframework.stereotype.Component;


/**
 * @author Qiuhua Lai
 * @email qhlai@gizwits
 */
@Slf4j
@Component
public class SpringReadyEvent implements ApplicationListener<ApplicationReadyEvent> {
    @Autowired
    private HomeDistanceMqttService homeDistanceMqttService;

    @Override
    public void onApplicationEvent(ApplicationReadyEvent event) {
        log.info("----------------------- 初始化离家回家 ---------------------");
        homeDistanceMqttService.init();
        log.info("----------------应用启动完成---------------");
    }

}
